package c570a1

class Book {
        String title
        String author
	String description
	String ISBN
	String category
	String language
	Integer minGradeLevel
	Integer maxGradeLevel

        static constraints = {
       		
		ISBN(nullable:true, matches: "97[89][0-9]{10}|[0-9]{10}") 
		author(blank:false)
		title( blank:false)
		
		language(nullable:true)
		description(nullable:true)
		minGradeLevel (min:0,max:6, validator:{
    value, reference ->
    return value <= reference.maxGradeLevel
  })
		maxGradeLevel (validator:{
    value, reference ->
    return value >= reference.minGradeLevel
  },max:6,min:0)
		category (matches: "General Leisure Reading|Reading skills|Math skills|Health|Science")	


	}


}

